package cate.game.activity.bosstrain;

import cate.game.activity.base.core.RoleActivitySingle;
import cate.game.activity.bosstrain.msg.BossTrainInfoResp;
import cate.game.role.Role;

public class BossTrainActivity extends RoleActivitySingle {
    public BossTrainFight fight;
    public BossTrainTask task;

    @Override
    public void initialize(Role role) {
        super.initialize(role);
        if (fight == null) {
            fight = new BossTrainFight();
        }
        fight.initialize(this);
        if (task == null) {
            task = new BossTrainTask();
        }
        task.initialize(this);
    }

    @Override
    public void onEnter() {
        super.onEnter();
        fight.onEnter();
    }

    @Override
    public void tick() {
        super.tick();
        if (!enable()) {
            return;
        }
        fight.tick();
    }

    @Override
    public void onDaySpan(boolean silence) {
        super.onDaySpan(silence);
        fight.onDaySpan(silence);
        task.onDaySpan(silence);
    }

    @Override
    public void excelCheck() {
        super.excelCheck();
        task.excelCheck();
    }

    @Override
    public void onRoleOpen() {
        super.onRoleOpen();
        fight.onRoleOpen();
        task.onRoleOpen();
    }

    @Override
    public void onRoleEnd() {
        super.onRoleEnd();
        fight.onRoleEnd();
        task.onRoleEnd();
    }

    @Override
    public void initSend() {
        noticeUpdate();
    }

    public void noticeUpdate() {
        role.sendNow(new BossTrainInfoResp(this));
    }
}
